<div class="header">
    <ul class="nav clear">
        <li class="address">
            <a href="">中国大陆</a>
        </li>
        <li class="site-nav-sign">
            <a href="/login">亲,请登录</a>
            <a href="/reg">免费注册</a>
        </li>
        <li class="site-nav-login hide">
            <a href="javascript:;" class="wel-tips">欢迎您,xxx</a>
            <a href="/info">用户信息</a>
            <a href="javascript:;" class="exit">退出</a>
        </li>
        <li>
            <a href="">手机淘宝</a>
        </li>
        <li>
            <a href="">网页无障碍</a>
        </li>
    </ul>
</div>
<script type="module">
    import {getCookie,delCookie} from "/js/cookie.js";

    var lgc = getCookie("lgc");
    var siteNavSign = document.getElementsByClassName("site-nav-sign")[0];
    var siteNavLogin = document.getElementsByClassName("site-nav-login")[0];


    if(lgc){
        siteNavSign.classList.add("hide");
        siteNavLogin.classList.remove("hide");

        siteNavLogin.firstElementChild.textContent = `欢迎您,${lgc}`;
        siteNavLogin.lastElementChild.onclick = function(){
            delCookie("lgc");
            location.reload();
        }
    }
</script>